package com.ruoyi.common.core.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

import java.util.List;

public interface IBaseMapper<T> extends BaseMapper<T> {
    /**
     * 查询所有
     *
     * @return
     */
    default List<T> selectAllList() {

        QueryWrapper<T> emptyWrapper = Wrappers.emptyWrapper();
        return selectList(emptyWrapper);
    }

    /**
     * 保存所有
     *
     * @param list
     */

    default void saveAll(List<T> list) {
        list.forEach(this::insert);
    }
}
